import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface DeleteModifierGroupById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetModifierNameHint_ {
  /**
   * @description 修饰词中文名称关键字
   * @example adas
   */
  cnName?: string;
}
export interface GetModifierById_ {
  /**
   * @description 主键id
   */
  id: number;
}
export interface PutModifierById_ {
  /**
   * @description 主键id
   */
  id: number;
}
export interface DeleteModifierById_ {
  /**
   * @description 主键id
   */
  id: number;
}

export class Modifier {
  /**
   * 添加修饰词词
   *
   * @tags 修饰词
   * @request POST: /modifier
   * @secure
   */
  postModifier = (body: defs.ModifierDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityModifierVO>({
      url: `/modifier`,
      method: "POST",
      data: body,
      ...params,
    });

  /**
   * 删除修饰词词
   *
   * @tags 修饰词
   * @request POST: /modifier/batch-delete
   * @secure
   */
  postModifierBatchDelete = (ids: number[], params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityBoolean>({
      url: `/modifier/batch-delete`,
      method: "POST",
      data: ids,
      ...params,
    });

  /**
   * 添加修饰词分组
   *
   * @tags 修饰词
   * @request POST: /modifier/group
   * @secure
   */
  postModifierGroup = (modifierGroupDTO: defs.ModifierGroupDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/modifier/group`,
      method: "POST",
      data: modifierGroupDTO,
      ...params,
    });

  /**
   * 修改修饰词分组
   *
   * @tags 修饰词
   * @request PUT: /modifier/group
   * @secure
   */
  putModifierGroup = (modifierGroupDTO: defs.ModifierGroupDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/modifier/group`,
      method: "PUT",
      data: modifierGroupDTO,
      ...params,
    });

  /**
   * 查询修饰词分组树
   *
   * @tags 修饰词
   * @request GET: /modifier/group/root
   * @secure
   */
  getModifierGroupRoot = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/modifier/group/root`,
      method: "GET",
      ...params,
    });

  /**
   * 删除修饰词分组
   *
   * @tags 修饰词
   * @request DELETE: /modifier/group/{id}
   * @secure
   */
  deleteModifierGroupById = ({ id }: { id: number } | DeleteModifierGroupById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/modifier/group/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 获取修饰词词列表
   *
   * @tags 修饰词
   * @request POST: /modifier/list
   * @secure
   */
  postModifierList = (body: defs.ModifierQueryDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoModifierVO>({
      url: `/modifier/list`,
      method: "POST",
      data: body,
      ...params,
    });

  /**
   * 下拉修饰词id
   *
   * @tags 修饰词
   * @request GET: /modifier/name-hint
   * @secure
   */
  getModifierNameHint = (query: { cnName?: string } | GetModifierNameHint_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListModifierVO>({
      url: `/modifier/name-hint`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 根据id获取修饰词信息
   *
   * @tags 修饰词
   * @request GET: /modifier/{id}
   * @secure
   */
  getModifierById = ({ id }: { id: number } | GetModifierById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityModifierVO>({
      url: `/modifier/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 更新修饰词词的元数据信息
   *
   * @tags 修饰词
   * @request PUT: /modifier/{id}
   * @secure
   */
  putModifierById = (
    { id }: { id: number } | PutModifierById_,
    body: defs.ModifierDTO,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityModifierVO>({
      url: `/modifier/${id}`,
      method: "PUT",
      data: body,
      ...params,
    });

  /**
   * 删除修饰词词
   *
   * @tags 修饰词
   * @request DELETE: /modifier/{id}
   * @secure
   */
  deleteModifierById = ({ id }: { id: number } | DeleteModifierById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityBoolean>({
      url: `/modifier/${id}`,
      method: "DELETE",
      ...params,
    });
}

export default new Modifier();
